// src/api/api.ts
import request from "@/utils/request";

/**
 * 获取门面列表
 * @param data
 * @returns
 */
export const getStoreListApi = (params: any) => {
  return request({
    url: "/api/store/list",
    method: "GET",
    params: params,
  });
};

/**
 * 新建或者更新门面
 * @param data
 * @returns
 */
export const saveOrUpdateStoreApi = (data: any) => {
  return request({
    url: "/api/store/saveOrUpdate",
    method: "POST",
    data: data,
  });
};

/**
 * 删除门面
 * @param id '门面Id'
 * @returns
 */
export const deleteStoreApi = (id: number) => {
  return request({
    url: `/api/store/delete/${id}`,
    method: "DELETE",
  });
};

/**
 * 获取单个门面
 * @param id
 * @returns
 */
export const getStoreByIdApi = (id: number) => {
  return request({
    url: `/api/store/getStore/${id}`,
    method: "GET",
  });
};

/**
 * 根据管理员获取单个门面
 * @param id
 * @returns
 */
export const getStoreByManagerApi = (id: number) => {
  return request({
    url: `/api/store/getStoreByManager/${id}`,
    method: "GET",
  });
};

/**
 * 根据门面ID获取商品信息
 * @param id
 * @returns
 */
export const getGoodsInStoreApi = (id: number) => {
  return request({
    url: `/api/store/getGoodsInStore/${id}`,
    method: "GET",
  });
};
